-
Notifications
You must be signed in to change notification settings - Fork 214
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename OPAQUE
to OPAQUE_ENUM
to deconflict with define in wingdi.h
#796
Conversation
Have you considered using a scoped enum instead? (C++ 11 feature)
becomes
This way we can keep our enum names, but also not play the "this platform's scope is polluted with X" game. |
The original reason for using a struct with constants as opposed to an enum is described here: #258 (comment) I'm not sure if an enum struct would work anyways. Here's a Godbolt example. |
Good example. I can't get that to work either. Looks like if I suppose the code that includes |
I think that is going to be unwinnable, given that the offending symbols are macros. I believe that spdlog is sucking wingdi.h into Cesium Native headers by including windows.h somewhere, and it might be possible rearrange or forward-declare the spdlog declarations so that wouldn't happen anymore in Cesium Native clients. But then any user who included windows.h themselves would run into this problem again. |
Possible related: I have more to say on this, will type it up soon. |
In my view, The only winning move, IMO, is not to play. Don't include #584 describes a case where a third-party library used by cesium-native fails to do this. The easiest workaround in that case is to enable exceptions, but it's probably reasonably easy to fix the library instead if necessary. Unless there's a case I'm not aware of where this sort of approach creates an undue burden, I'd much prefer it over modifying cesium-native to avoid Windows' many macros. |
Something else must be including I'm going to close this PR, but it would still be nice to fix this somehow. |
Renamed
CesiumGltf::Material::AlphaMode::OPAQUE
toOPAQUE_ENUM
to deconflict with the define inwingdi.h
The fix was to add
OPAQUE
to the reserved words list and add a suffix to enums using reserved words.Now projects using
CesiumGltf
don't need to add code like this everywhere:Unfortunately, this is a breaking change and it looks a little odd to see
OPAQUE_ENUM
,MASK
,BLEND
. So I'm open to alternatives here.